{template 'common/header'}
<title>{php echo $this->set['texts']['center']}</title>
<style type="text/css">
    body {
        margin: 0px;
        background: #eee;
        font-family: '微软雅黑';
    }

    a {
        text-decoration: none;
    }

    .topbar {
        height: 40px;
        padding: 10px;
        background: #fff;
    }

    .topbar .user_face {
        height: 40px;
        width: 40px;
        background: #ccc;
        float: left;
    }

    .topbar .user_face img {
        height: 100%;
        width: 100%;
    }

    .topbar .user_info {
        height: 40px;
        width: auto;
        float: left;
        margin-left: 12px;
    }

    .topbar .user_info .user_name {
        height: 24px;
        width: 100%;
        font-size: 16px;
        line-height: 24px;
        color: #666;
    }

    .topbar .user_info .user_name span {
        font-size: 14px;
        color: #ff6600
    }

    .topbar .user_info .user_date {
        height: 14px;
        width: 100%;
        font-size: 14px;
        line-height: 14px;
        color: #999;
    }

    .top {
        height: 180px;
        padding: 5px;
        background: #cc3431;
    }

    .top .top_1 {
        height: 114px;
        width: 100%;
    }

    .top .top_1 .text {
        height: 114px;
        width: auto;
        float: left;
        color: #fff;
        line-height: 50px;
        font-size: 14px;
        color: #fff;
    }

    .top .top_1 .ico {
        height: 40px;
        width: 30px;
        background: url('../addons/ewei_shop/plugin/commission/template/mobile/default/static/images/gold_ico2.png') 0 10px no-repeat;
        margin-bottom: 74px;
        float: right;
    }

    .top .top_2 {
        height: 66px;
        width: 100%;
        font-size: 40px;
        line-height: 66px;
        color: #fff;
    }

    .top .top_2 span {
        height: 32px;
        color: #fff;
        width: auto;
        border: 1px solid #fff;
        font-size: 14px;
        line-height: 32px;
        margin-top: 17px;
        padding: 0px 15px;
        float: right;
        border-radius: 5px;
    }

    .top .top_2 .disabled {
        color: #585858;
        border: 1px solid #B3B3B3;
        background-color: #ccc;
    }

    .menu {
        overflow: hidden;
        background: #fff;
    }

    .menu .nav {
        width: 33%;
        float: left;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .menu .nav .title {
        height: 24px;
        width: 100%;
        text-align: center;
        font-size: 14px;
        color: #666;
    }

    .menu .nav .con {
        height: 20px;
        width: 100%;
        text-align: center;
        font-size: 12px;
        color: #999;
    }

    .menu .nav .con span {
        color: #f90;
    }

    .menu .nav1 {
        border-bottom: 1px solid #f1f1f1;
        border-right: 1px solid #f1f1f1;
        text-align: center;
    }

    .menu .nav1 i {
        color: #ff9901;
    }

    .menu .nav2 {
        border-bottom: 1px solid #f1f1f1;
        border-right: 1px solid #f1f1f1;
        text-align: center;
    }

    .menu .nav2 i {
        color: #98cd37
    }

    .menu .nav3 {
        border-bottom: 1px solid #f1f1f1;
        text-align: center;
    }

    .menu .nav3 i {
        color: #ffcb05
    }

    .menu .nav4 {
        border-bottom: 1px solid #f1f1f1;
        border-right: 1px solid #f1f1f1;
        text-align: center;
    }

    .menu .nav4 i {
        color: #ca81d1
    }

    .menu .nav5 {
        border-bottom: 1px solid #f1f1f1;
        border-right: 1px solid #f1f1f1;
        text-align: center;
    }

    .menu .nav5 i {
        color: #53bdec
    }

    .menu .nav6 {
        border-bottom: 1px solid #f1f1f1;
        text-align: center;
    }

    .menu .nav6 i {
        color: #aadaf6
    }

    .menu .nav7 {
        border-bottom: 1px solid #f1f1f1;
        text-align: center;
        border-right: 1px solid #f1f1f1;
    }

    .menu .nav7 i {
        color: #f3d110
    }
</style>
<div id='container'></div>
<script id='tpl_main' type='text/html'>
    <div class="topbar">
        <div class="user_face"><img src="<%member.avatar%>"></div>
        <div class="user_info">
            <div class="user_name"
            <%if set.levelurl!=''%>onclick='location.href="<%set.levelurl%>"'<%/if%>><%member.nickname%>
            <span>
                [<%if level%>
                    <%level.levelname%>
                <%else%>
                    <%if set.levelname!=''%><%set.levelname%><%else%>普通等级<%/if%>
                <%/if%>]

                <%if set.levelurl!=''%>
                <i class='fa fa-question-circle' ></i>
            </span>
            <%/if%>
        </div>
        <div class="user_date">加入时间：<%member.agenttime%></div>
    </div>
    </div>

    <div class="top">
        <div class="top_1">
            <div class="text">{php echo $this->set['texts']['commission_total']}：<%member.commission_total%> 元<br>{php echo $this->set['texts']['commission_ok']}（元）</div>
            <a href="{php echo $this->createPluginMobileUrl('commission/withdraw')}"><div class="ico"></div></a>
        </div>
        <div class="top_2"><%member.commission_ok%><a <%if commission_ok<=0 || commission_ok< set.withdraw%>href="javascript:;"<%else%>href="{php echo $this->createPluginMobileUrl('commission/apply')}"<%/if%> id='withdraw' ><span <%if commission_ok<=0 || commission_ok< set.withdraw%>class='disabled'<%/if%> >{php echo $this->set['texts']['withdraw']}</span></a></div>
    </div>
    <div class="menu">
        <a href="{php echo $this->createPluginMobileUrl('commission/withdraw')}"><div class="nav nav1"><i class="fa fa-cny fa-3x"></i><div class="title">{php echo $this->set['texts']['commission1']}</div><div class="con"><span><%member.commission_total%></span>元</div></div></a>
        <a href="{php echo $this->createPluginMobileUrl('commission/team')}"><div class="nav nav2"><i class="fa fa-user  fa-3x"></i><div class="title">{php echo $this->set['texts']['myteam']}</div><div class="con"><span><%member.agentcount%></span>个成员</div></div></a>
        <a href="{php echo $this->createPluginMobileUrl('commission/order')}"><div class="nav nav3"><i class="fa fa-list fa-3x"></i><div class="title">{php echo $this->set['texts']['order']}</div><div class="con"><span><%member.ordercount0%></span>个订单</div></div></a>
        <a href="{php echo $this->createPluginMobileUrl('commission/log')}"><div class="nav nav4"><i class="fa fa-random  fa-3x"></i><div class="title">{php echo $this->set['texts']['commission_detail']}</div><div class="con">{php echo $this->set['texts']['commission']}明细</div></div></a>
        <a href="{php echo $this->createPluginMobileUrl('commission/shares')}"><div class="nav nav5"><i class="fa fa-qrcode  fa-3x"></i><div class="title">二维码</div><div class="con">推广二维码</div></div></a>
        <a href="{php echo $this->createPluginMobileUrl('commission/myshop/set')}"><div class="nav nav6"><i class="fa fa-cog  fa-3x"></i><div class="title">小店设置</div><div class="con">设置我的小店</div></div></a>

        <%if set.openselect%>
        <a href="{php echo $this->createPluginMobileUrl('commission/myshop/select')}"><div class="nav nav7"><i class="fa fa-star  fa-3x"></i><div class="title">自选商品</div><div class="con">选择我喜欢的商品</div></div></a>
        <%/if%>

    </div>
</script>

<script type="text/javascript">
require(['tpl', 'core'], function(tpl, core) {
    core.pjson('commission',{},function(json){
        var result = json.result;
        $('#container').html(  tpl('tpl_main',result) );
        $('#withdraw').click(function(){
            if(!json.result.cansettle){
                if(json.result.settlemoney>0){
                    core.tip.show('需到'+json.result.settlemoney+'元才能申请{php echo $this->set["texts"]["withdraw"]}!');
                }else{
                    core.tip.show('无可提{php echo $this->set["texts"]["commission"]}!');
                }
            }
        });
    },true);
});
</script>
{php $show_footer=true;$footer_current ='commission'}
{template 'common/footer'}